﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page"/>

<fmt:setBundle basename="ApplicationMessage"/>
<fmt:setLocale value="zh_CN"/>

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp" %>
  <%@ include file="/WEB-INF/include/css.jsp" %>

</head>

<body class="ms-theme-blue">

<%@ include file="/WEB-INF/include/header.jsp" %>
<%@ include file="/WEB-INF/include/submenu.jsp" %>

<div class="container-fluid ms-container has-ms-sidemenu">

  <ol class="ms-breadcrumb breadcrumb">
    <li class="active">订单管理&nbsp;-&nbsp;订单列表</li>
  </ol>
  <div class="ms-content-layout">
    <div class="x-operation-bar no-margin no-bottom-border clearfix">

      <ul class="nav nav-tabs ms-nav-tabs" role="tablist">
<%--        <li role="presentation" class="${isEnquiry ? 'active' : ''}">
          <a href="${ctx.host}/enquiries?type=${type}">询价单</a>
        </li>--%>
        <li role="presentation" class="${not empty status && status.editing ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=EDITING&type=${type}">编辑中</a>
        </li>
        <li role="presentation" class="${not empty status && status.unpaid ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=UNPAID&type=${type}">待支付</a>
        </li>
        <li role="presentation" class="${not empty status && status.waitingForTicket ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=WAITING_FOR_TICKET&type=${type}">待出票</a>
        </li>
        <li role="presentation" class="${not empty status && status.ticketed ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=TICKETED&type=${type}">已出票</a>
        </li>
        <li role="presentation" class="${not empty status && status.waitingForRefund ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=WAITING_FOR_REFUND&type=${type}">待退款</a>
        </li>
        <li role="presentation" class="${not empty status && status.canceled ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=CANCELED&type=${type}">已取消</a>
        </li>
        <li role="presentation" class="${not empty status && status.consumed ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?status=CONSUMED&type=${type}">已核销</a>
        </li>
<%--        <li role="presentation" class="${needPay ? 'active' : ''}">
          <a href="${ctx.host}/reverse-orders?type=${type}&needPay=true">再次支付</a>
        </li>--%>
      </ul>
      <div class="ms-operation-bar no-margin no-bottom-border clearfix">
        <div class="ms-operation-group">

          <div class="pull-right">
            <a href="${ctx.host}/reverse-orders/search?status=${status}&type=${type}" data-target="#search"
               data-toggle="modal" class="btn ms-btn ms-btn-blue"> <i
              class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
            </a>
          </div>

          <c:if test="${not empty status && type.aviation && status.editing}">
            <div class="pull-right" style="margin-right: 10px;">
              <a href="${ctx.host}/reverse-orders/create?orderType=${type}"<%-- data-target="#create"
                 data-toggle="modal"--%> class="btn ms-btn ms-btn-blue"> <i
                      class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;新建订单
              </a>
            </div>
          </c:if>

        </div>
      </div>

      <c:if test="${type.aviation && empty isEnquiry}">
        <jsp:include page="fragment/order-list-aviation-table-fragment.jsp"></jsp:include>
      </c:if>

      <c:if test="${not empty isEnquiry && isEnquiry}">
        <jsp:include page="fragment/order-list-enquiry-table-fragment.jsp"></jsp:include>
      </c:if>

    </div>
  </div>
</div>
<%@ include file="/WEB-INF/include/footer.jsp" %>
<%@ include file="/WEB-INF/include/script.jsp" %>
<d:resource type="script" root="${ctx.resource}/build"
            src="js/page/order/order-list.js"/>
<script type="text/javascript">
  require(['page/order/reverse-order-list'], function (page) {
    page.init({
      apiHost: "${config.apiHost}",
      cloudDomain: "${cloudContext.domain}"
    })
  })
</script>

</body>
</html>